﻿using Qy.Core;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Qy.Scenario;

[AppService]
public class UserPostService : QyRepository<UserPost>
{
    public UserPostService(ApplicationContext applicationContext) : base(applicationContext)
    {
    }

    public async Task<List<UserPost>> GetAllAsync()
    {
        return await GetAllListAsync("Sort asc");
    }

    public async Task<UserPost> GetInfo(int id)
    {
        List<UserPost> cates = await GetAllAsync();
        return cates.FirstOrDefault(a => a.Id == id);
    }
}
